package com.xdcplus.web.common.enums;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 实时库存结算的工序，固定死的
 */
public enum RealStockSettlementOpeEnum {

    JP( -1,"0","碱抛",null,BdFactoryEnum.PACK_FACTORY),
    RCA( -2,"0","RCA",null,BdFactoryEnum.PACK_FACTORY),
    FPCB(0,"1010","硅检段",null,BdFactoryEnum.HP_FACTORY),
    ZR( 1,"1020","制绒段",FPCB,BdFactoryEnum.HP_FACTORY),
    PK(2,"1030","硼扩段",ZR,BdFactoryEnum.HP_FACTORY),
    LDSE( 3,"1040","SE段",PK,BdFactoryEnum.HP_FACTORY),
    YH(4,"1050","氧化段",LDSE,BdFactoryEnum.HP_FACTORY),
    BSG(5, "2010","去BSG+碱抛段",YH,BdFactoryEnum.TOP_FACTORY),
    LPCVD( 6,"2020","LPCVD段",BSG,BdFactoryEnum.TOP_FACTORY),
    LK( 7,"2030","磷扩段",LPCVD,BdFactoryEnum.TOP_FACTORY),
    PSG(8, "2040","去PSG+RCA段",LK,BdFactoryEnum.TOP_FACTORY),
    ALD( 9,"3010","ALD段",PSG,BdFactoryEnum.PE_FACTORY),
    PECVDZM( 10,"3020","正面镀膜段",ALD,BdFactoryEnum.PE_FACTORY),
    PECVDBM( 11,"3030","背面镀膜段",PECVDZM,BdFactoryEnum.PE_FACTORY),
    SWYS( 12,"4010","丝网印刷段",PECVDBM,BdFactoryEnum.SY_FACTORY),
    CSFX( 13,"5010","分选机段",SWYS,BdFactoryEnum.PACK_FACTORY),
    PE( 14,"5020","流水线段",CSFX,BdFactoryEnum.PACK_FACTORY),
    BOXED( 15,"5030","未成箱段",PE,BdFactoryEnum.PACK_FACTORY),
    INSTOCK( 16,"5040","未入库段",BOXED,BdFactoryEnum.PACK_FACTORY),
    ;


    private String msg;
    private Integer order;
    private String code;
    private RealStockSettlementOpeEnum lastEnum;

    public BdFactoryEnum getFactoryCode() {
        return factoryCode;
    }

    public void setFactoryCode(BdFactoryEnum factoryCode) {
        this.factoryCode = factoryCode;
    }

    private BdFactoryEnum factoryCode;
    RealStockSettlementOpeEnum( Integer order,String code,String msg,RealStockSettlementOpeEnum lastEnum,BdFactoryEnum factoryCode) {
        this.msg = msg;
        this.order=order;
        this.code=code;
        this.lastEnum=lastEnum;
        this.factoryCode=factoryCode;
    }

    public String getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }

    public RealStockSettlementOpeEnum getLastEnum() {
        return lastEnum;
    }

    public void setLastEnum(RealStockSettlementOpeEnum lastEnum) {
        this.lastEnum = lastEnum;
    }

    public Integer getOrder() {
        return order;
    }

    public static List<RealStockSettlementOpeEnum> sortByValue() {
        return Stream.of(values())
                .filter(realStockSettlementOpeEnum -> realStockSettlementOpeEnum.getOrder()>-1)
                .sorted(Comparator.comparingInt(RealStockSettlementOpeEnum::getOrder))
                .collect(Collectors.toList());
    }



}
